<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>商家入驻</title>
<link rel="stylesheet" href="__HOME__/css/public_style.css">
<style>
	html,body{width:100%;height:100%;background-color:#f2f2f2;}
	/*-- 返回 --*/
	.ding_bg{
		height:52px;
		background-image: -moz-linear-gradient( 0deg, rgb(26,85,203) 0%, rgb(110,119,255) 100%);
		background-image: -webkit-linear-gradient( 0deg, rgb(26,85,203) 0%, rgb(110,119,255) 100%);
		background-image: -ms-linear-gradient( 0deg, rgb(26,85,203) 0%, rgb(110,119,255) 100%);
	}
	.ding_bg>p{text-align:center;color:#fff;float:left;width:calc(100% - 104px);line-height:52px;}
	.fanhui{padding:20px;height:12px;width:12px;display:block;float:left;}
	.fanhui>div{border-top:2px solid #fff;border-left:2px solid #fff;height:10px;width:10px;transform:rotate(-45deg);}
	/*-- 返回 --*/
	/*-- 商家入驻信息 --*/
	.seller_cont{padding-bottom:70px;}
	.seller_cont>ul{background-color:#fff;}
	.seller_cont>ul>li{padding:10px;border-bottom:1px solid #ccc;line-height:30px;}
	.seller_cont>ul>li>span{display:block;float:left;width:10px;color:#f00;text-align:center;padding-top:6px;height:24px;line-height:24px;}
	.seller_cont>ul>li>p{float:left;width:70px;color:#999;text-align-last:justify;font-size:14px;}
	.seller_cont>ul>li>input{display:block;float:left;width:calc(100% - 80px);border:none;height:30px;outline:none;}
	.seller_cont>ul>li:hover p{color:#2f9bfe;}
	
	.seller_cont>div{padding:10px;border-bottom:1px solid #ccc;border-top:1px solid #ccc;background-color:#fff;color:#999;font-size:14px;margin-top:20px;line-height:30px;}
	
	.seller_cont>ol img{width:100%;}
	.seller_cont>ol>li{height:70px;width:70px;float:left;padding:4px;border:1px dashed #ccc;margin:10px;overflow:hidden;}
	.seller_cont>ol>li>input{display:block;width:100%;height:100%;position:relative;top:-100%;opacity:0;}
	.seller_cont>ol>li:nth-of-type(1){padding:14px;height:50px;width:50px;}
	
	.seller_cont>button{
		border:none;display:block;height:40px;line-height:40px;color:#fff;width:224px;margin:10px auto;border-radius:20px;outline:none;
		background-image: -moz-linear-gradient( 0deg, rgb(26,85,203) 0%, rgb(110,119,255) 100%);
		background-image: -webkit-linear-gradient( 0deg, rgb(26,85,203) 0%, rgb(110,119,255) 100%);
		background-image: -ms-linear-gradient( 0deg, rgb(26,85,203) 0%, rgb(110,119,255) 100%);
	}
	/*-- 商家入驻信息 --*/

</style>
</head>

<body>
	<!-- 返回 -->
	<div class="ding_bg">
		<a href="index.html" class="fanhui"><div></div></a>
		<p>商家入驻</p>
		<h6 class="clearfix"></h6>
	</div>
	<!-- 返回 -->
	<!-- 商家入驻信息 -->
	<form method="post" enctype="multipart/form-data" action="javascript:;" id="myForm" name="formshop" onsubmit="return subfor()">

		<div class="seller_cont">
			<ul>
				<li>
					<span>*</span>
					<p>商家名称：</p>
					<input type="text" name="name" required>
					<h6 class="clearfix"></h6>
				</li>
				<li>
					<span>*</span>
					<p>手机号：</p>
					<input type="text" name="phone" required oninput="this.value= value.replace(/\D/g,'')">
					<h6 class="clearfix"></h6>
				</li>
				<li>
					<span>*</span>
					<p>主要经营：</p>
					<input type="text" name="major" required>
					<h6 class="clearfix"></h6>
				</li>
				<li>
					<span>*</span>
					<p>店铺地址：</p>
					<input type="text" name="address" required>
					<h6 class="clearfix"></h6>
				</li>
<!-- 				<li>
					<span>*</span>
					<p>详细地址：</p>
					<input type="text" name="address" required>
					<h6 class="clearfix"></h6>
				</li> -->
			</ul>
			<div>营业执照</div>
			<ol>
				<li>
					<img src="__HOME__/img/shangchuan_img.png" alt="">
					<input type="file" name="zhizhao" id="myFile">
				</li>
				<li>
					<img src="__HOME__/img/lingqu_an.png" alt=""  id="olimg">
				</li>
				
			</ol>
			<h6 class="clearfix"></h6>
			<button>申请入驻</button>
		</div>
	</form>
	<!-- 商家入驻信息 -->
	<!-- 底部按钮区 -->
	<div class="footer">
		<div onClick="location.href='{:url('index')}'">
			<div><div style="background-position-X:-24px"></div></div>
			<p>首页</p>
		</div>		
		<div onClick="location.href='{:url('shop')}'">
			<div><div></div></div>
			<p>商家</p>
		</div>

		<div id="saoyisao" onclick="location.href='/index/index/scan.html'">
			<div><div></div></div>
			<p>扫一扫</p>
		</div>
		<div>
			<div><div style="background-position:-48px -24px"></div></div>
			<p>商家入驻</p>
		</div>
		<div onClick="location.href='{:url('personal')}'">
			<div><div style="background-position-X:-72px"></div></div>
			<p>我的</p>
		</div>
		<h6 class="clearfix"></h6>
	</div>
	<!-- 底部按钮区 -->
</body>
<script src="__HOME__/js/jquery-3.3.1.js"></script>
<script src="__HOME__/js/layer.js"></script>
<script>

	var doit;
	function subfor(){
		event.preventDefault();

		if(doit == true)return false;

		doit = true;
		var forD = new FormData( document.getElementById("myForm"));

		var phone = forD.get("phone");

		if(!(/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(phone))){
			
			layer.open({ content: '请输入正确的手机号' ,skin: 'msg' ,time: 2});
			return false;
	    }

		$.ajax({
			
			'url' : '/index/index/ajaxShop',
			'type':'POST',
			'data':forD,
			'processData':false,  
     		'contentType':false,
			success:function(data){

				switch(data){
					case 'repeat': 
						layer.open({ content: '商家名重复' ,skin: 'msg' ,time: 2});;
						break;
					case 1: 
						layer.open({ content: '上传成功，待审核' ,skin: 'msg' ,time: 2});;
						location.href="/index/index/index.html"
						break;
					default:
						layer.open({ content: '上传失败' ,skin: 'msg' ,time: 2});; 
					break;
				}
				doit = false;
				return false;	

			}

		});
		return false;		
	}

	$('#myFile').change(function(){

		var file = document.getElementById('myFile');
		var img  = document.getElementById('olimg');
		img.src= window.URL.createObjectURL(file.files[0]);
	})
</script>
</html>
